<div class="crumb-wrap">
    <div class="crumb-list"> <i class="icon-font"></i>
        <a href="<?=site_url()?>">首页</a>
        <span class="crumb-step">&gt;</span>
        <span>余额信息</span>
    </div>
</div>

<style type="text/css">
    .show_table th{
        text-align: center;
    }
</style>
<div class="result-wrap">
        <div class="config-items">
            <div class="result-content">
                <table class="insert-tab show_table" width="100%">
                    <tr style="background: #f5f5f5">
                        <th width="150">订单号</th>
                        <th>项目名称</th>
                        <th>支付积分</th>
                        <th>购买积分</th>
                        <th>返还积分</th>
                        <th>订单状态</th>
                        <th>系统备注</th>
                        <th>创建时间</th>
                        <th>状态</th>
                    </tr>
                    <?php foreach($list as $k => $v):?>
                    <tr>
                        <th><?=$v['order_id']?></th>
                        <th><?=$v['project']['title']?> - <?=$v['par']['title']?></th>
                        <th><?=$v['order']['price']?></th>
                        <th><?=$v['actual_price']?></th>
                        <th><?=$v['balance']?></th>
                        <th><?=$v['sorder']?></th>
                        <th><?=$v['order']['remarks']?></th>
                        <th><?=date('Y-m-d H:i:s',$v['create_time'])?></th>
                        <?php if($v['status'] == 1):?>
                            <th style="color: green"> 可领取 </th>
                        <?php elseif($v['status'] == 2):?>
                            <th style="color:red"> 不可领取 </th>
                        <?php else:?>
                            <th>已领取</th>
                        <?php endif;?>
                    </tr>
                    <?php endforeach;?>
                </table>

                <table width="100%" class="insert-tab" style="margin-top: 10px">
                    <tr>
                        <th width="150">可分配积分余额：</th>
                        <td><?=empty($balance) ? '0' : $balance?></td>
                    </tr>
                    <tr>
                        <th width="150"></th>
                        <td><a href="javascript:;" onclick="to_balance()" class="btn btn6 mr10 btn-primary">转入积分余额</a></td>
                    </tr>
                </table>
                <div class="list-page"><?=$page?></div>
            </div>
        </div>
</div>

<script type="text/javascript">
    function to_balance(){
        layer.confirm("是否将<?=$balance?>余额资金全部转入余额中？", {
            icon:0,
            btn: ['确定','取消'] //按钮
        },function(){
            $.get("<?=site_url('money/to_balance')?>",function(data){
                if(data == 1){
                    layer.alert("转入成功！",{
                        icon:1,
                    },function(){
                        location.reload();
                    });
                }else{
                    layer.alert(data,{
                        icon:2,
                    });
                }
            });
        })
    }
</script>